US 2010/0086098 A1 discloses a photon counting CdZnTe (CZT) pixelated detector comprising an anode, a cathode and a CZT crystal between the anode and the cathode for converting x-ray radiation into electrons and holes, wherein the electrons are collected by the anode and a detection signal is generated depending on the collected electrons. The performance of the detector is critically affected by a charging of the CZT crystal, which leads to an internal electrical field counteracting a bias voltage applied to the anode and the cathode. This polarization of the detector is reduced by using infrared light having one or more specific wavelengths.